define(function(require, exports){
	exports.onMain = function( boot, data, app ) {
		if(!app.routerValid('admin.product')) {
			return;
		}

		var title = LANG('产品报表');

		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title:title,
			type: 'sidebar'
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name + 'product', 'product/action/list.main', {
			tabText: LANG('产品')
		}, function(mod, created){
			if(created){
				mod.reload();
			}
		});
	};

	exports.onEdit = function( boot, data, app ) {
		var id = data.param;
		var auth = id ? 'product.update' : 'product.add';
		if(!app.routerValid(auth)) {
			return;
		}

		var title = id ? LANG('编辑产品') : LANG('新建产品');

		var con = app.getContainer({
			scenes: 'main',
			full: false,
			sitelist: false,
			setup_btn: false,
			title: title,
			sidebar: false,
			type: 'scroll'
		});

		app.core.get('SYS_PLATFORM').setPlatform(title);

		con.createBusiness(data.name, 'product/action/edit.main', {

		}, function( mod ) {
			mod.reset();
			if( id ) {
				mod.load( id );
			}
		});
	};
});